package com.huidao.data;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import com.huidao.domain.User;

public class dataBase {
	// 创建输出流
	private static BufferedWriter bwUser;
	private static BufferedWriter bw;
	// 创建实例一个输入流，将用户信息读出
	private static BufferedReader brUser;
	private static BufferedReader br;
	// 创建一个集合存储用户名及密码
	private static List<String> registList;
	private static List<String> list;

	// 创建一个集合存储用户信息
	private static List<User> userList;
	private static List<User> managerList;
	static {

		try {
			// 写数据的缓冲流
			bwUser = new BufferedWriter(new FileWriter("registUser.txt", true));
			bw = new BufferedWriter(new FileWriter("manager.txt", true));
			// 读数据的缓冲流
			brUser = new BufferedReader(new FileReader("registUser.txt"));
			br = new BufferedReader(new FileReader("manager.txt"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		list = new ArrayList<String>();
		registList = new ArrayList<String>();
		userList = new ArrayList<User>();
		managerList = new ArrayList<User>();
	}

	public dataBase() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @return the bwUser
	 */
	public static BufferedWriter getBw() {
		return bw;
	}

	/**
	 * @return the brUser
	 */
	public static BufferedReader getBr() {
		return br;
	}

	/**
	 * @return the registList
	 */
	public static BufferedWriter getBwUser() {
		return bwUser;
	}

	/**
	 * @return the brUser
	 */
	public static BufferedReader getBrUser() {
		return brUser;
	}

	/**
	 * @return the list
	 */
	public static List<String> getList() {
		return list;
	}

	public static List<String> getRegistList() {
		// TODO Auto-generated method stub
		return registList;
	}

	/**
	 * @return the userList
	 */

	public static List<User> getUserList() {
		// TODO Auto-generated method stub
		return userList;
	}

	/**
	 * @return the managerList
	 */
	public static List<User> getManagerList() {
		return managerList;
	}

}
